

jQuery(function ($) {
    //推荐名家
    var recommendParam = {
        "hof_cat_url": "zhongshuxie",
        "page": 0,
        "size": 8
    };
    send_ajax('post', '/api/hof/artist_list', recommendParam, function callback(res) {
        var recommendHtml = "";
        if (res.code == 200) {
            var data = res.data.content;
            if (data.length > 0) {
                for (var i = 0; i < data.length; i++) {
                    recommendHtml += "<li>\n                                            <a target=\"_blank\"  href=\"/mj/zuozhe-" + data[i].id + "/\" class=\"mj_logo\">\n                                                <img src=\"" + isImgHttp(data[i].portrait) + "\" alt=\"" + data[i].name + "\">\n                                            </a>\n                                            <div>\n                                                <a href=\"/mj/zuozhe-" + data[i].id + "/\" target=\"_blank\">" + data[i].name + "&nbsp&nbsp" + data[i].professionalTitle.split(',')[0] + ("  </a>\n                                                <span>" + data[i].profession + "</span>\n                                            </div>\n                                    </li>");
                };
                $('.mj_list ').html(recommendHtml); //中书协艺术家nav
            } else {
                $('.mj_list ').append('<li>没有数据</li>');
            }
        };
    });
    //推荐作品
    var params = {
        "hof_cat_url": "zhongshuxie",
        "page": 0,
        "size": 8
    };
    send_ajax('post', '/api/hof/recommend_goods_list', params, function callback(res) {
        var recommendHtml = "";
        if (res.code == 200) {
            var data = res.data.content;
            if (data.length > 0) {
                for (var i = 0; i < data.length; i++) {
                    recommendHtml += " <li class=\"swiper-slide \">\n                                            <div class=\"pic\">\n                                                <a target=\"_blank\" href=\"/goods-" + data[i].id + ".html\"><img src=\"" + (data[i].thumb ? isImgHttp(data[i].thumb) : '//static.yczihua.com/images/201803/1520979355119049923.jpg') + "\" alt=\"" + data[i].name + "\"></a>\n                                            </div>\n                                            <div class=\"pic_content\">\n                                                <p><a href=\"/goods-" + data[i].id + ".html\" target=\"_blank\">" + data[i].name + "</a></p>\n                                                <p>\u6613\u4ECE\u4EF7\uFF1A<span class=\"picPrice\"><em>\uFFE5</em>" + data[i].goodsPrice + "</span></p>\n                                            </div>\n                                        </li>";
                };
                $('.swiper-wrapper').html(recommendHtml);
            } else {
                $('.swiper-wrapper').html('<li>没有数据</li>');
            }
        }
        //启用轮播图
        var mySwiper = new Swiper('.swiper-container ', {
            slidesPerView: 4,
            loop: true,
            observer: true,
            observeParents: true,
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev'
            }
        });
    });
});